/*-----------------------------------------------------------------
   Project    : PlaygroundJ2eeBrasil
   Package    : com.wsc.j2eebrasil.utilitarios.commandprompt
   File name  : Prompt.java
   Author     : Wilson Soethe Cursino            Date: Apr 18, 2008
   Description:    
   Notes:   
   Revision History:
   Name:           Date:        Description:
  -----------------------------------------------------------------*/
package com.wsc.j2eebrasil.utilitarios.commandprompt;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Prompt {
    public static void main(String args[]) {
        try {
            Runtime rt = Runtime.getRuntime();
            Process proc = rt.exec("dir c:\\windows");
            InputStream stdin = proc.getInputStream();
            InputStreamReader isr = new InputStreamReader(stdin);
            BufferedReader br = new BufferedReader(isr);
            String line = null;
            System.out.println("--------- SAIDA ---------");
            while ((line = br.readLine()) != null)
                System.out.println(line);
            System.out.println("-------- FIM SAIDA -------");
            int exitVal = proc.waitFor();
            System.out.println("Saida: " + exitVal);
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
}
